﻿
@{
    ViewBag.Title = "Quản lý thuộc tính sản phẩm";
    Layout = "~/Areas/Admin/Views/Shared/__AdminLayout.cshtml";
}
@section _Head {
<style type="text/css">

    .field-validation-error
    {
        position: absolute;
        display: block;
    }
    
    * html .field-validation-error { position: relative; }
    *+html .field-validation-error { position: relative; }
    
    .field-validation-error span
    {
        position: absolute;
        white-space: nowrap;
        color: red;
        padding: 17px 5px 3px;
        background: transparent url('@Url.Content("~/Content/Common/validation-error-message.png") ') no-repeat 0 0;
    }
    
    /* in-form editing */
    .t-edit-form-container
    {
        width: 250px;
        margin: 1em;
    }
    
    .t-edit-form-container .editor-label,
    .t-edit-form-container .editor-field
    {
        padding-bottom: 1em;
        float: left;
    }
    
    .t-edit-form-container .editor-label
    {
        width: 30%;
        text-align: right;
        padding-right: 3%;
        clear: left;
    }
    
    .t-edit-form-container .editor-field
    {
        width: 60%;
    }
</style>
}
<div>
    <h2>
        Quản lý thuộc tính của sản phẩm</h2>
</div>
@( Html.Telerik().Grid<Sealight.UI.WebUI.Models.ProductAttributeViewModel>()
        .Name("GridProductSpecification")
            .DataKeys(keys =>
            {
                keys.Add(o => o.ID);
            })
            .ToolBar(commands =>
            {
                commands.Insert().ButtonType(GridButtonType.Text).ImageHtmlAttributes(new { style = "margin-left:0" });
            })

            .DataBinding(dataBinding => {
                dataBinding.Ajax().Select("_ProductAttributeSelectAjaxEditing", "Product")
                .Insert("_ProductAttributeInsertAjaxEditing", "Product")
                .Update("_ProductAttributeSaveAjaxEditing", "Product")
                .Delete("_ProductAttributeDeleteAjaxEditing", "Product");
 })
        .Columns(columns =>
        {
            columns.Bound(o => o.ID).Hidden();
            columns.Bound(o => o.Name).Width(200).Title("Tên");

            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Text);
                commands.Delete().ButtonType(GridButtonType.Text);
            }).Width(180).Title("");
       
        }).Editable(editing => editing.Mode(GridEditMode.PopUp))
            .Pageable(page => { page.PageSize(20); })
)
